package com.lyy.mybatis.sensitive;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.yaml.snakeyaml.Yaml;

import java.io.InputStream;
import java.util.Arrays;
import java.util.HashMap;

@SpringBootApplication
@Slf4j
@MapperScan("com.lyy.*")
public class TestApplication {
    public static void main(String[] args) {
        InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("application.yml");
        HashMap ymlMap = new Yaml().loadAs(inputStream, HashMap.class);

        SpringApplication sa = new SpringApplication(TestApplication.class);
        sa.setDefaultProperties(ymlMap);
        sa.run(args);
    }
}
